<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <script type="text/javascript" src="../js/axios.js"></script>
</head>
<body>
  
  <script type="text/javascript">
    /*
      async/await处理多个异步任务
    */
    axios.defaults.baseURL = 'http://localhost:8082';
    
    // 异步函数
    async function queryData() {
      // 第一次请求
      const promise1 = await axios.get('async1');
      // 第二次请求
      const promise2 = await axios.get('async2?args=' + promise1.data);
      // const promise2 = await axios.get('async2?args=' + promise1.data+"222");
      return promise2.data;
    }

    queryData().then(function(data){
      console.log(data)
    })
  </script>
</body>
</html>